import { MockMethod } from 'vite-plugin-mock';
import { resultPageSuccess, resultSuccess } from '../_util';

const demoList = (() => {
  const result: any[] = [];
  for (let index = 0; index < 60; index++) {
    result.push({
      id: `${index}`,
      categoryName: '@ctitle',
      inventoryAlertQuantity: '@integer(100,200)',
      effectiveDays: '@integer(100,200)',
      description: '@csentence(10,25)',
      imgurlString: '@image',
      children: [
        {
          id: `${index}`,
          categoryName: '@ctitle',
          inventoryAlertQuantity: '@integer(100,200)',
          effectiveDays: '@integer(100,200)',
          description: '@csentence(10,25)',
          imgurlString: '@image',
        },
      ],
    });
  }
  return result;
})();

enum Api {
  list = '/assetcategory/assetCategory/rootList',
  save = '/assetcategory/assetCategory/add',
  edit = '/assetcategory/assetCategory/edit',
  deleteAssetCategory = '/assetcategory/assetCategory/delete',
  importExcel = '/assetcategory/assetCategory/importExcel',
  exportXls = '/assetcategory/assetCategory/exportXls',
  loadTreeData = '/assetcategory/assetCategory/loadTreeRoot',
  getChildList = '/assetcategory/assetCategory/childList',
  getChildListBatch = '/assetcategory/assetCategory/getChildListBatch',
}
const prefix = '/jeecgboot';
export default [
  // {
  //   url: prefix + Api.list,
  //   timeout: 1000,
  //   method: 'get',
  //   response: ({ query }) => {
  //     const { page = 1, pageSize = 20 } = query;
  //     return resultPageSuccess(page, pageSize, demoList);
  //   },
  // },
  // {
  //   url: prefix + Api.loadTreeData,
  //   timeout: 1000,
  //   method: 'get',
  //   response: () => {
  //     return resultSuccess([
  //       {
  //         label: '椅子',
  //         value: 1,
  //         children: [
  //           { label: '小椅子', value: 2 },
  //           { label: '大椅子', value: 3 },
  //         ],
  //       },
  //       {
  //         label: '桌子',
  //         value: 4,
  //         children: [
  //           { label: '小桌子', value: 5 },
  //           { label: '大桌子', value: 6 },
  //         ],
  //       },
  //     ]);
  //   },
  // },
  // {
  //   url: prefix + Api.save,
  //   timeout: 1000,
  //   method: 'post',
  //   response: () => {
  //     return resultSuccess('ok');
  //   },
  // },
  // {
  //   url: prefix + Api.save,
  //   timeout: 1000,
  //   method: 'post',
  //   response: () => {
  //     return resultSuccess('ok');
  //   },
  // },
  // {
  //   url: prefix + Api.deleteAssetCategory,
  //   timeout: 1000,
  //   method: 'delete',
  //   response: () => {
  //     return resultSuccess('ok');
  //   },
  // },
] as MockMethod[];
